package binary;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

//十六进制
public class HexDemo {
    public static void main(String[] args) {
        /*
        16进制:缩写二进制
        1)0x为16进制字面量前缀
        2)0b为二进制字面量前缀
         */
        int n=0x2fd47b;
        int m=0b10_1111_1101_0100_0111_1011;
        System.out.println(Integer.toBinaryString(n));//按二进制输出
        System.out.println(Integer.toBinaryString(m));

        System.out.println(Integer.toHexString(n));//按十六进制输出
        System.out.println(Integer.toHexString(m));

        System.out.println(n);//按十进制输出
        System.out.println(m);

        int max=Integer.MAX_VALUE;
        int min=Integer.MIN_VALUE;
        System.out.println(Integer.toBinaryString(max));
        System.out.println(Integer.toBinaryString(min));
        System.out.println(Integer.toBinaryString(-1));

        int n1=-45;
        System.out.println(Integer.toBinaryString(n1));
    }
}
